package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.dao.EmployeeDao;
import com.itheima.domain.Employee;
import com.itheima.service.EmployeeService;
import org.springframework.stereotype.Service;



@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao,Employee> implements EmployeeService {

    //表中username唯一约束调用getOne(),用户名查询用户是否存在.
    @Override
    public Employee login(Employee employee) {
        // 1.根据用户名查询用户信息 Employe
        LambdaQueryWrapper<Employee> qr = new LambdaQueryWrapper<>();
        // 封装条件
        qr.eq(Employee::getUsername,employee.getUsername());
        // 简写返回查询到的对象
        return this.getOne(qr);

    }
}
